#include<stdio.h>

char fBrace = '{';          //123
char bBrace = '}';          //125
char semicolon = ';';       //59
char space = ' ';           //32
char newline = '\n';        //10


main(int argc,char *argv[])
{
    char ch;
    FILE *ifp;
	FILE *ofp;
    int i;
	void transProgram(FILE *, FILE *);
	
    if((ifp=fopen(argv[1],"r"))==NULL)
    {
        printf("targetProgram.c not open");   
    }
	if((ofp=fopen("transformed.c","w+"))==NULL)
    {
        printf("transformed.c not open");
    }
	
    transProgram(ifp, ofp);
	
    fclose(ifp);
	fclose(ofp);
	
	return 0;
}

void transProgram(FILE *ifp, FILE *ofp)
{
    
	int  intentwidth = 5;
	char ch;
	/*
	int nofBrace = 0;
	int nBrace(FILE *);
	nofBrace = nBrace(ifp);
	
	printf("%d, %d, %d, %d, %d\n", fBrace, bBrace, semicolon, space, newline);
	
	printf("number of Braces %d", nofBrace);
	*/
	
	while ((ch=fgetc(ifp))!=EOF)
	{
		fputc(ch, ofp);
	}
	/*
	while ((ch=fgetc(ofp))!=EOF)
	{
		ch = fgetc(ofp);
		if(ch == fBrace)
		{
		    ch = bBrace;
			printf("%d", ch);
		}
		fputc(ch, ofp);
	}
	*/
}


int nBrace(FILE *ifp)
{
    int i = 0;
    char ch;
    while ((ch=fgetc(ifp))!=EOF)
	{
	   if (ch == fBrace || ch == bBrace)
	   {
	        i++;    
       }
	}
    return i;
}

